package com.oncliedisk.administrator.ui;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;

import com.oncliedisk.administrator.Base.BaseActivity;
import com.oncliedisk.administrator.DB.Dao;
import com.oncliedisk.administrator.model.FileModel;

/**
 * Created by Administrator on 2015/12/11.
 */
public class ShowFolder extends BaseActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initData();
    }



    private void initData() {
        FileModel model = (FileModel) getIntent().getSerializableExtra("data");
        setTitle(model.getName());
        initAdapter(Dao.getInstance(this).getFileById(model.getId()));
        listView.setAdapter(adapter);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
        super.onItemClick(adapterView, view, position, l);
        FileModel item = (FileModel) adapter.getItem(position);
        setTitle(item.getName());
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        super.onKeyDown(keyCode, event);
        return super.onKeyDown(keyCode, event);
    }
}
